<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2023-01-11
 * Time: 20:12
 */

namespace App\validate;
use think\Validate;

class User extends Validate
{
    protected $rule = [
        'username'  => 'require|max:25|alphaDash',
        'password'=>'require|length:6,20',
        'roles' => 'array',
    ];

    protected $message = [
        'username.require' => '名称必须',
        'username.max'     => '名称最多不能超过25个字符',
        'username.alphaDash'     => '名称只能是字母数字和下划线',
        'password.require'   => '密码必须',
        'password.length'   => '密码必须介于6至20个字符',
    ];
}